package cn.fl.ref.fncprjdrawmon.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import fl.ref.fncprjdrawmon.dto.FncPrjDrawMonDTO;
import cn.fl.ref.fncprjdrawmon.vo.FncPrjDrawMonVO;

/**
 * 服务层与展现层转换类
 * 所有的PO只能在持久成和服务层使用
 * 所有的DTO只能在展现层和服务层使用
 * 在服务层中向下是DTO转PO,向上是PO转DTO
 */
public class FncPrjDrawMonVOTransform {

	/**
	 * VO 转  DTO
	 * @param po
	 * @return
	 */
	public static FncPrjDrawMonDTO toDTO(FncPrjDrawMonVO vo) {
		FncPrjDrawMonDTO  dto = null;
		if (vo != null) { 
			dto = new FncPrjDrawMonDTO();
			dto.setId(vo.getId());
			
            dto.setDmTm(vo.getDmTm());  
   
            dto.setDmAm(vo.getDmAm());  
   
            dto.setDueBank(vo.getDueBank());  
   
            dto.setDmSt(vo.getDmSt());  
   
            dto.setDmAcc(vo.getDmAcc());  
   
            dto.setPrjId(vo.getPrjId());  
   
            dto.setAccId(vo.getAccId());  
   
			
			
		}
		return dto;
	}

	/**
	 * DTO 转  PO
	 * @param dto
	 * @return
	 */
	public static FncPrjDrawMonVO toVO(FncPrjDrawMonDTO dto) {
		FncPrjDrawMonVO vo = null;
		if (dto != null) {
			vo = new FncPrjDrawMonVO();
			vo.setId(dto.getId());
            vo.setDmTm(dto.getDmTm());  
   
            vo.setDmAm(dto.getDmAm());  
   
            vo.setDueBank(dto.getDueBank());  
   
            vo.setDmSt(dto.getDmSt());  
   
            vo.setDmAcc(dto.getDmAcc());  
   
            vo.setPrjId(dto.getPrjId());  
   
            vo.setAccId(dto.getAccId());  
   
		}
		return vo;
	}
	
	/**
	 * PO集合 转 DTO集合
	 * @param list
	 * @return
	 */
	public static List<FncPrjDrawMonDTO> toDTOList(List<FncPrjDrawMonVO> list) {
		List<FncPrjDrawMonDTO>  voList = new ArrayList<FncPrjDrawMonDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (FncPrjDrawMonVO vo : list) {
				voList.add(toDTO(vo));
			}
		}
		return voList;
	}
	
	/**
	 * DTO集合 转 PO集合
	 * @param list
	 * @return
	 */
	public static List<FncPrjDrawMonVO> toVOList(List<FncPrjDrawMonDTO> list) {
		List<FncPrjDrawMonVO>  voList = new ArrayList<FncPrjDrawMonVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (FncPrjDrawMonDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
}
